package com.chacha.beans;


import java.util.List;

import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;

import com.chacha.dao.CommonFunctionDao;
import com.chacha.framework.common.models.DashboardObject;
import com.chacha.framework.common.models.DashboardValue;
import com.chacha.framework.common.models.PagingObject;

/**
 * Session Bean implementation class CommonFunction
 */
@Stateless(mappedName = "NIM/CommonFunction")
@LocalBean
public class CommonFunction implements CommonFunctionRemote {

   @EJB
   private CommonFunctionDao dao;
   
   private String jndi="jdbc/NIM";
   
    public CommonFunction() {
    }

	@Override
	public List<DashboardValue> getNews(List<DashboardValue> selectKeyword) {
		return dao.getSingleRow(jndi, "NIM_NEWS", selectKeyword);
	}

	@Override
	public String updateNews(List<DashboardValue> datas,
			List<DashboardValue> where) {
		return dao.updateData(jndi, "NIM_NEWS", datas, where);
	}

	@Override
	public String insertSharedDocs(List<DashboardValue> datas) {
		return dao.insertData(jndi, "SHARED_DOC", datas);
	}

	@Override
	public String updateSharedDocs(List<DashboardValue> datas,
			List<DashboardValue> where) {
		// TODO Auto-generated method stub
		return dao.updateData(jndi, "SHARED_DOC", datas, where);
	}

	@Override
	public String deleteSharedDocs(List<DashboardValue> where) {
		return dao.deleteData(jndi, "SHARED_DOC", where);
	}

	@Override
	public List<DashboardObject> getSharedDocs(
			List<DashboardValue> selectKeyword, List<DashboardValue> keywords,
			PagingObject paging) {
		return dao.getStandartList(jndi, "SHARED_DOC", selectKeyword, keywords, paging);
	}

	
}
